from rest_framework import serializers
from good import models


# def verify(value):
#     data = models.Good.objects.filter(name=value)
#     if data:
#         raise serializers.ValidationError("商品重复")
#     else:
#         return value


class GoodSer(serializers.ModelSerializer):
    class Meta:
        model = models.Good
        fields = "__all__"
        # extra_kwargs = {"name": {'required': True, "validators": [verify]}}


class ShopSer(serializers.ModelSerializer):
    class Meta:
        model = models.Shops
        fields = "__all__"
